/* الأساسيات */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
}

:root {
  --primary-color: #4a3260;
  --secondary-color: rgba(86, 59, 85, 0.681);
  --dark-color: #121212;
  --light-color: #f8f9fa;
  --gray-color: #2d2d2d;
}

/* Body */
body {
  background-color: var(--dark-color);
  color: var(--light-color);
  line-height: 1.6;
  transition: all 0.3s ease;
  overflow-x: hidden;
  min-height: 100vh;
}

body.light-mode {
  background-color: var(--light-color);
  color: var(--dark-color);
}

/* Container */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
}

/* Cursor */
.cursor-dot {
  width: 8px;
  height: 8px;
  background-color: var(--primary-color);
  border-radius: 50%;
  position: fixed;
  top: 0;
  left: 0;
  pointer-events: none;
  z-index: 9999;
  transition: transform 0.1s;
  opacity: 0;
}

.cursor-outline {
  width: 40px;
  height: 40px;
  border: 2px solid var(--primary-color);
  border-radius: 50%;
  position: fixed;
  top: 0;
  left: 0;
  pointer-events: none;
  z-index: 9998;
  transition: all 0.2s ease-out;
  opacity: 0;
}

body.custom-cursor .cursor-dot,
body.custom-cursor .cursor-outline {
  opacity: 1;
}

/* Header */
header {
  background-color: var(--dark-color);
  padding: 15px 0;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  position: fixed;
  width: 100%;
  top: 0;
  z-index: 1000;
}

.light-mode header {
  background-color: var(--light-color);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

.logo {
  font-size: 24px;
  font-weight: 700;
  display: flex;
  align-items: center;
}

.logo-img {
  width: 50px;
  height: 40px;
  border-radius: 50%;
  margin-left: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: bold;
  filter: drop-shadow(0 0 8px #541e54) drop-shadow(0 0 15px #b266b2);
  transition: 0.3s ease-in-out;
}

.logo-img:hover {
  filter: drop-shadow(0 0 12px #541e54) drop-shadow(0 0 25px #d080d0);
}

/* Nav */
nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.nav-links {
  display: flex;
  list-style: none;
}

.nav-links li {
  margin-left: 25px;
}

.nav-links a {
  color: var(--light-color);
  text-decoration: none;
  font-weight: 500;
  transition: all 0.3s ease;
  font-size: 0.9rem;
}

.light-mode .nav-links a {
  color: var(--dark-color);
}

.nav-links a:hover {
  color: var(--primary-color);
}

/* أزرار */
.language-switcher,
.theme-switcher,
.menu-toggle {
  background: var(--gray-color);
  color: var(--light-color);
  border: none;
  padding: 6px 12px;
  border-radius: 20px;
  cursor: pointer;
  margin-left: 15px;
  transition: all 0.3s ease;
  font-size: 0.8rem;
}

.light-mode .language-switcher,
.light-mode .theme-switcher,
.light-mode .menu-toggle {
  background: #e9ecef;
  color: var(--dark-color);
}
.menu-toggle:hover,
.theme-switcher:hover,
.language-switcher:hover {
  background: var(--primary-color);
  color: white;
}
/* زر العودة */
.back-btn {
  display: inline-flex;
  align-items: center;
  padding: 12px 25px;
  background: transparent;
  border: 2px solid var(--primary-color);
  color: var(--primary-color);
  border-radius: 50px;
  text-decoration: none;
  font-weight: 600;
  transition: all 0.3s ease;
  margin-bottom: 30px;
  box-shadow: 0 4px 12px rgba(138, 43, 226, 0.2);
}

.light-mode .back-btn {
  color: var(--primary-color);
}

.back-btn:hover {
  background: var(--primary-color);
  color: white;
  transform: translateY(-3px);
  box-shadow: 0 8px 20px rgba(138, 43, 226, 0.4);
}

.back-btn i {
   margin-left: 10px;
  transition: transform 0.3s ease;
}


.back-btn:hover i {
  transform: translateX(5px);
}

[dir="ltr"] .back-btn:hover i {
  transform: translateX(5px);
}
/*------*/
.sidebar {
  position: fixed;
  top: 0;
  right: -350px;
  width: 300px;
  height: 100vh;
  background: linear-gradient(to bottom, var(--dark-color), #1a1a1a);
  box-shadow: -5px 0 15px rgba(0, 0, 0, 0.3);
  transition: right 0.4s ease;
  z-index: 2000;
  padding: 80px 20px 20px;
  overflow-y: auto;
}
/* ===== حل نهائي: ترتيب المسافة بين الأيقونة والنص في السايدبار ===== */

/* 1) تأكد أن روابط السايدبار تستخدم flex بحيث يمكن عمل مسافة بسهولة */
.sidebar-nav a {
  display: flex;
  align-items: center;
  gap: 8px; /* المسافة بين الأيقونة والنص (عمل ممتاز على المتصفحات الحديثة) */
  white-space: nowrap; /* يمنع التفاف النص لداخل الأيقونة */
}

/* 2) اجعل الأيقونة صندوق ثابت العرض حتى النص ما يلزق فيها */
.sidebar-nav i {
  min-width: 28px;   /* عرض ثابت صغير يكفي للأيقونة */
  width: 28px;
  display: inline-flex;
  justify-content: center;
  text-align: center;
  margin: 0;         /* إلغاء أي مارجن سابق */
}

/* 3) إعدادات خاصة عندما تكون الصفحة باللغة الإنجليزية (LTR) */
body[dir="ltr"] .sidebar-nav a {
  flex-direction: row;  /* أيقونة على اليسار، نص على اليمين */
  text-align: left;
}
body[dir="ltr"] .sidebar-nav i {
  margin-right: 8px !important; /* تأمين المسافة إذا كانت هناك قواعد تِغيِرها */
  margin-left: 0 !important;
}

/* 4) إعدادات خاصة عندما تكون الصفحة بالعربية (RTL) */
body[dir="rtl"] .sidebar-nav a {
  flex-direction: row-reverse; /* أيقونة على اليمين، نص على اليسار */
  text-align: right;
}
body[dir="rtl"] .sidebar-nav i {
  margin-left: 8px !important;
  margin-right: 0 !important;
}

/* 5) احتياط: لو الأيقونات تُضاف عبر ::before بدل عنصر i */
.sidebar-nav a::before {
  display: inline-block;
  margin-right: 8px;
}
body[dir="rtl"] .sidebar-nav a::before {
  margin-left: 8px;
  margin-right: 0;
}
.light-mode .sidebar {
  background: linear-gradient(to bottom, var(--light-color), #e9ecef);
  box-shadow: -5px 0 15px rgba(0, 0, 0, 0.1);
}

.sidebar.active {
  right: 0;
}

.sidebar-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  z-index: 1999;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
}

.sidebar-overlay.active {
  opacity: 1;
  visibility: visible;
}

.sidebar-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 30px;
  padding-bottom: 15px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.light-mode .sidebar-header {
  border-bottom: 1px solid rgba(0, 0, 0, 0.1);
}

.sidebar-title {
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--light-color);
}

.light-mode .sidebar-title {
  color: var(--dark-color);
}

.close-sidebar {
  background: transparent;
  border: none;
  color: var(--light-color);
  font-size: 1.5rem;
  cursor: pointer;
  transition: color 0.3s ease;
}

.light-mode .close-sidebar {
  color: var(--dark-color);
}

.close-sidebar:hover {
  color: var(--primary-color);
}

.sidebar-nav {
  list-style: none;
  margin-bottom: 30px;
}

.sidebar-nav li {
  margin-bottom: 15px;
}

.sidebar-nav a {
  display: flex;
  align-items: center;
  padding: 12px 15px;
  color: var(--light-color);
  text-decoration: none;
  border-radius: 8px;
  transition: all 0.3s ease;
  font-weight: 500;
}

.light-mode .sidebar-nav a {
  color: var(--dark-color);
}

.sidebar-nav a:hover {
  background: rgba(74, 50, 96, 0.3);
  color: var(--primary-color);
  transform: translateX(-5px);
}

.light-mode .sidebar-nav a:hover {
  background: rgba(74, 50, 96, 0.1);
}

.sidebar-nav i {
  margin-left: 10px;
  font-size: 1.1rem;
  width: 20px;
  text-align: center;
}

.sidebar-social {
  display: flex;
  justify-content: center;
  gap: 15px;
  margin-top: 40px;
}

.sidebar-social a {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 45px;
  height: 45px;
  background: var(--primary-color);
  color: white;
  border-radius: 50%;
  text-decoration: none;
  transition: all 0.3s ease;
  font-size: 1.1rem;
}

.sidebar-social a:hover {
  transform: translateY(-5px);
  background: var(--secondary-color);
}

.sidebar-contact {
  margin-top: 30px;
  padding-top: 20px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  text-align: center;
}

.light-mode .sidebar-contact {
  border-top: 1px solid rgba(0, 0, 0, 0.1);
}

.sidebar-contact p {
  margin-bottom: 10px;
  color: var(--light-color);
  font-size: 0.9rem;
}

.light-mode .sidebar-contact p {
  color: var(--dark-color);
}

.sidebar-contact a {
  color: var(--primary-color);
  text-decoration: none;
  font-weight: 600;
}

/* Hero */
.hero {
  padding: 130px 0 60px;
  background: linear-gradient(to bottom, var(--dark-color), #1a1a1a);
  min-height: 100vh;
  display: flex;
  align-items: center;
}

.light-mode .hero {
  background: linear-gradient(to bottom, var(--light-color), #e9ecef);
}

.hero-container {
  display: flex;
  flex-direction: column;
  gap: 30px;
}

/* قسم المدونة المفردة */
.blog-post {
  background: var(--dark-color);
  border-radius: 16px;
  padding: 20px;
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.2);
  margin-top: 5px;
}

.light-mode .blog-post {
  background: var(--light-color);
}

.blog-header {
  margin-bottom: 30px;
}

.blog-title {
  font-size: 2.5rem;
  margin-bottom: 15px;
  color: var(--primary-color);
}

.blog-meta {
  color: #ced4da;
  font-size: 1rem;
}

.light-mode .blog-meta {
  color: #495057;
}

.blog-content {
  font-size: 1.1rem;
  line-height: 1.8;
}

.blog-content p {
  margin-bottom: 20px;
}

.blog-content h2 {
  margin: 25px 0 15px;
  color: var(--primary-color);
}

.blog-content ol,
.blog-content ul {
  margin: 15px 0;
  padding-right: 20px;
}

[dir="ltr"] .blog-content ol,
[dir="ltr"] .blog-content ul {
  padding-left: 20px;
  padding-right: 0;
}

.blog-content li {
  margin-bottom: 10px;
}

/* صورة المدونة الكبيرة */
.blog-featured-image {
  width: 100%;
  height: auto;
  margin: 30px 0;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
  position: relative;
}

.blog-featured-image img {
  width: 100%;
  height: auto;
  display: block;
  transition: transform 0.5s ease;
}

.blog-featured-image:hover img {
  transform: scale(1.03);
}

.image-caption {
  text-align: center;
  font-style: italic;
  margin-top: 10px;
  color: #ced4da;
  font-size: 0.9rem;
}

.light-mode .image-caption {
  color: #6c757d;
}

/* Footer */
footer {
  padding: 25px 0;
  background-color: #0a0a0a;
  color: white;
  text-align: center;
}

.light-mode footer {
  background-color: #dee2e6;
  color: var(--dark-color);
}

/* Responsive */
@media (max-width: 992px) {
  .nav-links {
    display: none;
  }

  .blog-title {
    font-size: 2rem;
  }
}

@media (max-width: 768px) {
  .blog-featured-image {
    margin: 20px 0;
  }
}

@media (max-width: 576px) {
  .blog-post {
    padding: 20px;
  }

  .blog-title {
    font-size: 1.8rem;
  }

  .blog-featured-image {
    border-radius: 8px;
  }
}
/* 🔹 جعل الشعار والأزرار في صف واحد حتى في الجوال */
header nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: nowrap;
}

/* الشعار (الصورة + النص) */
header .logo {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* الحاوية اللي فيها الأزرار الثلاثة */
header nav > div:last-child {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* 🔹 في الجوال */
@media (max-width: 768px) {
  header nav {
    flex-direction: row; /* خليهم صف واحد دائمًا */
  }

  header .logo img {
    width: 40px; /* تصغير بسيط للشعار عشان يركب بالسطر */
    height: auto;
  }

  header .logo-text {
    font-size: 1rem;
  }

  .language-switcher,
  .theme-switcher,
  .menu-toggle {
    flex-shrink: 0; /* ما يتقلص حجمها */
  }
}